import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';

const routes = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/login',
            component: () => import('@/views/login/index.vue'),
            meta: { title: '登录' },
        },
        {
            path: '/about',
            component: () => import('@/views/about/index.vue'),
            meta: { title: '关于我们' },
        },
        {
            path: '/help',
            component: () => import('@/views/help/index.vue'),
            meta: { title: '帮助中心' },
        },
        {
            path: '/',
            component: () => import('@/views/layout/main-head.vue'),
            meta: { title: '灯杆系统' },
            children: [
                {
                    path: '/',
                    component: () => import('@/views/home/index.vue'),
                    meta: { title: '首页' },
                },
                {
                    path: '/map',
                    component: () => import('@/views/map/index.vue'),
                    meta: { title: '地图' },
                },
            ]
        },
        {
            path: '/admin',
            component: () => import('@/views/layout/main.vue'),
            meta: { title: '管理' },
            children: [
                {
                    path: '',
                    component: () => import('@/views/admin/home/index.vue'),
                    meta: { title: '首页' },
                },
                //照明管理
                {
                    path: 'lighting',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '照明管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/lighting/index.vue'),
                            meta: { title: '概况' },
                        },
                        {
                            path: 'real-monitor',
                            component: () => import('@/views/admin/lighting/real-monitor/index.vue'),
                            meta: { title: '实时控制' },
                        },
                        {
                            path: 'history-data',
                            component: () => import('@/views/admin/lighting/history-data/index.vue'),
                            meta: { title: '历史数据' },
                        },
                        {
                            path: 'fault-alarm',
                            component: () => import('@/views/admin/lighting/fault-alarm/index.vue'),
                            meta: { title: '故障告警' },
                        },
                        {
                            path: 'list',
                            component: () => import('@/views/admin/lighting/list/index.vue'),
                            meta: { title: '照明列表' },
                        }
                    ]
                },
                //屏幕管理
                {
                    path: 'screen',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '屏幕管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/screen/index.vue'),
                            meta: { title: '概况' },
                        },
                        {
                            path: 'screen-list',
                            component: () => import('@/views/admin/screen/screen-list/index.vue'),
                            meta: { title: '屏幕列表' },
                        },
                        {
                            path: 'program-list',
                            component: () => import('@/views/admin/screen/program-list/index.vue'),
                            meta: { title: '节目列表' },
                        },
                        {
                            path: 'media-resources',
                            component: () => import('@/views/admin/screen/media-resources/index.vue'),
                            meta: { title: '媒体资源' },
                        },
                    ]
                },
                //监控管理
                {
                    path: 'monitor',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '监控管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/monitor/index.vue'),
                            meta: { title: '概况' },
                        },
                        {
                            path: 'monitor-list',
                            component: () => import('@/views/admin/monitor/monitor-list/index.vue'),
                            meta: { title: '外网监控' },
                        },
                        {
                            path: 'monitor-playback',
                            component: () => import('@/views/admin/monitor/monitor-playback/index.vue'),
                            meta: { title: '视频回放' },
                        }
                    ]
                },
                //广播管理
                {
                    path: 'radio',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '广播管理' },
                    children: [
                        {
                            path: 'list',
                            component: () => import('@/views/admin/radio/list/index.vue'),
                            meta: { title: '广播列表' },
                        },
                        {
                            path: 'media-library',
                            component: () => import('@/views/admin/radio/media-library/index.vue'),
                            meta: { title: '媒体库' },
                        },
                    ]
                },
                //预警管理
                {
                    path: 'alert',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '预警管理' },
                    children: [
                        {
                            path: 'list',
                            component: () => import('@/views/admin/alert/list/index.vue'),
                            meta: { title: '预警信息' },
                        },
                        {
                            path: 'order',
                            component: () => import('@/views/admin/alert/order/index.vue'),
                            meta: { title: '订单信息' },
                        },
                    ]
                },
                //充电管理
                {
                    path: 'charge',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '充电管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/charge/index.vue'),
                            meta: { title: '概况' },
                        },
                        {
                            path: 'list',
                            component: () => import('@/views/admin/charge/list/index.vue'),
                            meta: { title: '充电桩' },
                        },
                    ]
                },
                //气象管理
                {
                    path: 'sensor',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '气象管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/sensor/index.vue'),
                            meta: { title: '传感器数据' },
                        },
                        {
                            path: 'list',
                            component: () => import('@/views/admin/sensor/list/index.vue'),
                            meta: { title: '传感器列表' },
                        },
                    ]
                },
                //5G管理
                {
                    path: '5g',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '5G管理' },
                    children: [
                        {
                            path: 'list',
                            component: () => import('@/views/admin/5g/list/index.vue'),
                            meta: { title: 'AP管理' },
                        },
                        {
                            path: 'user-records',
                            component: () => import('@/views/admin/5g/user-records/index.vue'),
                            meta: { title: '终端用户记录' },
                        },
                    ]
                },
                //报警管理
                {
                    path: 'alarm',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '报警管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/alarm/index.vue'),
                            meta: { title: '接警' },
                        },
                        {
                            path: 'equipment',
                            component: () => import('@/views/admin/alarm/equipment/index.vue'),
                            meta: { title: '对讲设备' },
                        }
                    ]
                },
                //策略管理
                {
                    path: 'strategy',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '策略管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/strategy/index.vue'),
                            meta: { title: '概况' },
                        },
                        {
                            path: 'time-strategy',
                            component: () => import('@/views/admin/strategy/time-strategy/index.vue'),
                            meta: { title: '时间策略' },
                        },
                        {
                            path: 'sensor-strategy',
                            component: () => import('@/views/admin/strategy/sensor-strategy/index.vue'),
                            meta: { title: '感应器策略' },
                        }
                    ]
                },
                //灯杆管理
                {
                    path: 'lamp-post',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '灯杆管理' },
                    children: [
                        {
                            path: 'list',
                            component: () => import('@/views/admin/lamp-post/index.vue'),
                            meta: { title: '灯杆列表' },
                        },
                    ]
                },
                //网关管理
                {
                    path: 'gateway',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '网关管理' },
                    children: [
                        {
                            path: 'list',
                            component: () => import('@/views/admin/gateway/index.vue'),
                            meta: { title: '网关列表' },
                        },
                    ]
                },
                //区域管理
                {
                    path: 'area',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '区域管理' },
                    children: [
                        {
                            path: 'list',
                            component: () => import('@/views/admin/area/index.vue'),
                            meta: { title: '区域列表' },
                        },
                    ]
                },
                //用户管理
                {
                    path: 'user',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '用户管理' },
                    children: [
                        {
                            path: 'list',
                            component: () => import('@/views/admin/user/list/index.vue'),
                            meta: { title: '用户列表' },
                        },
                        {
                            path: 'role',
                            component: () => import('@/views/admin/user/role/index.vue'),
                            meta: { title: '角色列表' },
                        },
                        {
                            path: 'permission',
                            component: () => import('@/views/admin/user/permission/index.vue'),
                            meta: { title: '角色权限' },
                        }
                    ]
                },
                //商家管理
                {
                    path: 'business',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '屏幕管理' },
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/admin/business/index.vue'),
                            meta: { title: '概况' },
                        },
                    ]
                },
                 //通用页面
                 {
                    path: 'common',
                    component: () => import('@/views/layout/router-view.vue'),
                    meta: { title: '通用页面' },
                    children: [
                        {
                            path: 'set-key',
                            component: () => import('@/views/common/set-key/index.vue'),
                            meta: { title: '参数设置' },
                        },
                        {
                            path: 'category',
                            component: () => import('@/views/common/category/index.vue'),
                            meta: { title: '类型' },
                        },
                    ]
                },
            ]
        },
        {
            path: '/:catchAll(.*)*',
            component: () => import('@/views/error/index.vue'),
            meta: { title: '404错误页面' },
        }
    ]
})

export default routes;
